const mysql = require("mysql");

const db = mysql.createPool({
  host: "111.229.220.153",
  user: "Juejing",
  password: "Juejing0518cc",
  database: "Juejing",
  port: 3306,
  charset: "utf8mb4",
});

//查询
const query = (sql, values) => {
  return new Promise((resolve, reject) => {
    db.query(sql, values, (err, results) => {
      if (err) reject(err);
      resolve(results);
    });
  });
};

module.exports = { db, query };
